<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<div class="portlet box blue">
	<div class="portlet-title">
		<div class="caption">
			<i class="fa fa-gift"></i>新增入库
		</div>
	</div>
	<div class="portlet-body form">
		<form id="putForm" class="form-horizontal form-bordered"
			action="/put/save" method="post">
			<!-- 入库仓库 -->
			<div class="form-group ">
				<label class="col-md-3 control-label">入库仓库:</label>
				<div class="col-md-4">
					<div class="input-icon right">
						<i class="fa"></i> <select class="form-control" name="warehouseId">
							<c:if test="${not empty put }">
								<option value="${put.warehouseId}">${put.warehouse.name }</option>
							</c:if>
							<c:forEach items="${warehouses}" var="warehouse" varStatus="vs">
								<option value="${warehouse.id}">${warehouse.name}</option>
							</c:forEach>
						</select>
					</div>
				</div>
			</div>

			<!-- 所属分类 -->
			<div class="form-group ">
				<label class="col-md-3 control-label">所属分类<span
					style="color: red;">&nbsp;*&nbsp;</span>:
				</label>
				<div class="col-md-4">
					<div class="input-icon right">
						<i class="fa"></i> <input type="hidden" name="productTypeId"
							value="${put.product.productTypeId }" /> <input type="text"
							class="form-control" name="productTypeName" required
							onclick="showProductType()" required placeholder="点击选择类型"
							style="cursor: pointer;" value="${put.product.productType.name }"
							readonly="readonly" />
					</div>
				</div>
			</div>

			<!-- 选择商品 -->
			<div class="form-group ">
				<label class="col-md-3 control-label">选择商品<span
					style="color: red;">&nbsp;*&nbsp;</span>:
				</label>
				<div class="col-md-4">
					<div class="input-icon right">
						<input type="hidden" name="productCode"
							value="${put.product.code}" /> <i class="fa"></i> <select
							class="form-control" id="chooseProduct"
							onchange="document.getElementById('chooseProduct').title=this.options[this.selectedIndex].value;"
							name="productId" required="required">
						</select>
					</div>
				</div>
			</div>

			<!-- 实际收货 -->
			<div class="form-group ">
				<label class="col-md-3 control-label">实际收货<span
					style="color: red;">&nbsp;*&nbsp;</span>:
				</label>
				<div class="col-md-4">
					<div class="input-icon right">
						<i class="fa"></i><input class="form-control" type="text"
							name="box" value="${put.box}" required="required" maxlength="45" />
					</div>
				</div>
			</div>
			<!-- 箱数 -->
			<div class="form-group ">
				<label class="col-md-3 control-label">箱数 <span
					style="color: red;">&nbsp;*&nbsp;</span>:
				</label>
				<div class="col-md-4">
					<div class="input-icon right">
						<i class="fa"></i><input class="form-control" type="text"
							name="realbox" value="${put.realbox}" required="required"
							maxlength="45" />
					</div>
				</div>
			</div>
			<!-- 入库描述 -->
			<div class="form-group ">
				<label class="col-md-3 control-label">入库描述:</label>
				<div class="col-md-4">
					<div class="input-icon right">
						<i class="fa"></i>
						<textarea class="form-control" rows="5" name="description">${put.description}</textarea>
					</div>
				</div>
			</div>
			<div class="form-actions">
				<div class="col-md-9 col-md-offset-3">
					<button type="button" class="btn btn-primary"
						onclick="saveAgain(this,'/put/put')">保存并新增</button>
					<button type="button" class="btn btn-primary" onclick="save(this)">
						保存并关闭</button>
					<button type="reset" class="btn btn-default" onclick="cancel()">关闭</button>
				</div>
			</div>
			<input type="hidden" name="id" value="${put.id}">
		</form>
	</div>
</div>
<!-- 隐藏的树状组织 -->
<div class="modal fade" id="productTypeAreaModal" tabindex="-1"
	role="basic" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true"></button>
				<h4 class="modal-title">所属类型</h4>
			</div>
			<div class="modal-body">
				<ul id="productTypeArea" class="ztree"
					style="margin-top: 0; width: 160px;"></ul>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn blue" onclick="makeSureType()">确定</button>
				<button type="button" class="btn default" data-dismiss="modal">关闭</button>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript"
	src="<c:url value="/static/custom/datepicker-util.js"></c:url>"></script>
<script type="text/javascript"
	src="<c:url value="/static/custom/save.js"></c:url>"></script>
<script type="text/javascript">
	$(function() {
		$('#putForm').validate();
	});
</script>